package com.itzhigui.service.impl;

import com.itzhigui.entity.User;
import com.itzhigui.mapper.UserMapper;
import com.itzhigui.service.UserService;
import com.itzhigui.utils.ResponseUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author java1412
 * @since 2023-11-08 17:03:33
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public ResponseUtil findByNamedAndPwd(User user) {
        User loginUser = userMapper.findByNameAndPwd(user);
        return loginUser != null ?
                ResponseUtil.ok("登录成功", loginUser) : ResponseUtil.fail("登录失败");
    }
}
